package com.jing.shop.domain;

import com.jing.common.core.domain.R;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {

    private Integer code;
    private String msg;
    private T data;

    public static<T> Result<T> success(Integer code,String msg,T data){
        return new Result<T>(code,msg,data);
    }

    public static<T> Result<T> success(Integer code,T data){
        return new Result<T>(code,"成功",data);
    }

    public static<T> Result<T> success(Integer code){
        return new Result<T>(code,"成功",null);
    }

    public static<T> Result<T> error(Integer code,String msg){
        return new Result<T>(code,msg,null);
    }

}
